package com.zhixi.pattern.notimportant.mediatorpattern.operation;

import java.util.Random;

/**
 * 销售
 *
 * @作者 ShuHaoNan
 * @邮箱 shuhaonan1@gmail.com
 * @时间 2020/11/17 9:06
 */
public class Sale extends AbstractColleague {

    public Sale(AbstractMediator mediator) {
        super(mediator);
    }

    /**
     * 销售电脑
     */
    public void sellIBMComputer(int number) {
        super.mediator.execute("sale.sell", number);
    }

    /**
     * 查看电脑销售状态
     */
    public int getSaleStatus() {
        Random random = new Random(System.currentTimeMillis());
        int saleStatus = random.nextInt(100);
        System.out.println("电脑销售状态情况为:" + saleStatus);
        return saleStatus;
    }

    /**
     * 打折销售
     */
    public void offSale() {
        System.out.println("折价销售电脑" + super.mediator.stock.getStockNumber() + "台");
    }

}
